//
//  Util.h
//  vm
//
//  Created by 孔祥 on 14-9-27.
//  Copyright (c) 2014年 孔祥. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <Foundation/NSDateFormatter.h>
#import <UIKit/UIColor.h>
#import <UIKit/UIAlertView.h>


@interface Util : NSObject

+ (BOOL) isBlankString:(NSString *)string;
+ (int) indexOf:(NSString *)subStr forString:(NSString *)text;
+ (UIColor*) uiColorFromHexString:(NSString *)hexstr;

+(int) gmt;
+(NSInteger) toGMTFromNSDate:(NSDate*)nsDate;
+(NSDate*) toNSDateFromGMT:(NSInteger)dbLong;

+(NSDate*) toNSDateFromString:(NSString*)uiDate;
+(NSDate*) toZeroHourDate:(NSDate*)nsDate;
+(NSDate*) zeroHourDate:(long)longDate;
+(NSDate *)toNSDateFromRfc3339String:(NSString *)rfc3339DateTimeString;
+(NSString *)toRfc3339DateTimeString:(NSDate *)date;

+ (NSMutableDictionary *) dictWithNsnullKVs:(NSArray *)firstObject, ... NS_REQUIRES_NIL_TERMINATION;

+ (NSString * ) createDirIfNotExist:(NSString *)relPath;
+ (BOOL) delFileIfExist:(NSString *)relPath;
+ (BOOL) rename:(NSString *)relPath  fromName:(NSString *)fromPath   toName:(NSString *)toPath;
+ (NSString *) getABSpath:(NSString *)relPath  fileName:(NSString *)fromPath;

+ (NSMutableArray *)sortArray:(NSArray *)array  fieldName:(NSString *)fldkey  ascending:(BOOL)ascending;

+ (NSNumber *) toNSNumber:(id)val;
+ (NSNumber *) toNSDateNumber:(id)val;
+ (int) toInt:(id)val;
+ (long) toLong:(id)val;

+ (void)showMessageAlert:(NSString *)message;

+ (int)getRandomNumber:(int)from to:(int)to;

+ (NSArray *)splitToInts:(NSString *)str;
+ (BOOL) startWith:(NSString*)prefix forString:(NSString*)text;

+ (BOOL) judgeFileIfExist:(NSString *)filename relPath:(NSString *)relPath;

+(id) getParam:(NSString*)pname fromPlist:(NSString*)fname;
+(NSMutableDictionary*) getRefreshDict:(NSString*)name;
+(void) setRefreshDict:(NSString*)name dict:(NSDictionary*)dict;

+(NSDictionary *)filterDictionary:(NSDictionary *)dict from:(NSString *)from to:(NSString *)to;

@end
